<?php

namespace App\Libraries\DataBase\Schema;

use Illuminate\Database\Schema\Blueprint;

trait hasCreatedUserAttribute
{
    public function hasCreated(Blueprint $table, array $columns = ['time' => ['name' => 'created_at', 'title' => '创建日期'], 'user' => ['name' => 'created_user_id', 'title' => '创建用户主键']])
    {
        $table->timestamp($columns['time']['name'])->nullable()->comment($columns['time']['title']);
        $table->string($columns['user']['name'])->nullable()->comment($columns['user']['title']);
    }

    public function hasCreatedOnlyTime(Blueprint $table, array $columns = ['time' => ['name' => 'created_at', 'title' => '创建日期']])
    {
        $table->timestamp($columns['time']['name'])->nullable()->comment($columns['time']['title']);
    }
}
